package com.seu.clab.farm.model.dto.post;

import com.seu.clab.farm.model.dao.entity.Account;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.URL;

import javax.persistence.EmbeddedId;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AccountDTO {
    private String accountId;
    @NotBlank
    private String name;
    @Pattern(regexp = "\\d{6,11}")
    private String phone;

    private String email;
    @Pattern(regexp = "\\d{17}[0-9,x,X]")
    private String identify;

    private String avatar;

    public Account toAccount()
    {
          Account account=new Account();
          account.setAccountId(accountId);
          account.setName(name);
          account.setPhone(phone);
          account.setEmail(email);
          account.setIdentify(identify);
          account.setAvatar(avatar);
          return account;
    }
}
